package com.antler.smt.admin.service.impl;

import com.antler.smt.admin.mapper.RecruitmentInfoMapper;
import com.antler.smt.enums.ResultCodeEnum;
import com.antler.smt.request.admin.RecruitmentReq;
import com.antler.smt.response.admin.GetRecruitmentResp;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.admin.RecruitmentManagementService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *  发布需求管理服务
 *
 * @author zhangyi
 * @date 2018/9/28 10:57
 */
@Service
public class RecruitmentManagementServiceImpl implements RecruitmentManagementService {

    @Autowired
    private RecruitmentInfoMapper recruitmentInfoMapper;

    /**
     * 分类查询招聘需求
     *
     * @param recruitmentReq
     * @return
     */
    @Override
    public Result searchRecruitment(RecruitmentReq recruitmentReq) {
        Result result = null;
        Page<GetRecruitmentResp> getRecruitmentResps =
                recruitmentInfoMapper.searchRecruitment(recruitmentReq);
        if(getRecruitmentResps != null){
            result = new Result(new PageInfo(getRecruitmentResps));
        }else {
            result = new Result(ResultCodeEnum.QUERY_DATA_ERROR,"查询招聘失败");
        }
        return result;
    }
}
